const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
  return sequelize.define('t_project_info', {
    projectId: {
      type: DataTypes.BIGINT,
      allowNull: false,
      primaryKey: true,
      comment: "项目ID",
      field: 'project_id'
    },
    projectName: {
      type: DataTypes.STRING(1000),
      allowNull: true,
      comment: "项目名称",
      field: 'project_name'
    },
    projectType: {
      type: DataTypes.STRING(64),
      allowNull: true,
      comment: "项目类型",
      field: 'project_type'
    },
    projectAddress: {
      type: DataTypes.STRING(1000),
      allowNull: true,
      comment: "项目地址",
      field: 'project_address'
    },
    progress: {
      type: DataTypes.STRING(3000),
      allowNull: true,
      comment: "施工进度"
    },
    county: {
      type: DataTypes.STRING(64),
      allowNull: true,
      comment: "所在区县"
    },
    userId: {
      type: DataTypes.BIGINT,
      allowNull: true,
      comment: "项目负责账号ID",
      field: 'user_id'
    },
    manager: {
      type: DataTypes.STRING(32),
      allowNull: true,
      comment: "监管员姓名"
    },
    managerPhone: {
      type: DataTypes.STRING(32),
      allowNull: true,
      comment: "监管员联系方式",
      field: 'manager_phone'
    },
    placeCode: {
      type: DataTypes.STRING(1024),
      allowNull: true,
      comment: "场所码",
      field: 'place_code'
    },
    isCityProject: {
      type: DataTypes.STRING(2),
      allowNull: true,
      comment: "是否市管项目",
      field: 'is_city_project'
    },
    isStop: {
      type: DataTypes.STRING(2),
      allowNull: true,
      comment: "是否停工",
      field: 'is_stop'
    },
    riskLevel: {
      type: DataTypes.STRING(2),
      allowNull: true,
      comment: "风险等级",
      field: 'risk_level'
    },
    regulators: {
      type: DataTypes.STRING(64),
      allowNull: true,
      comment: "监管部门"
    },
    remarks: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "备注"
    },
    isDeleted: {
      type: DataTypes.INTEGER,
      allowNull: true,
      comment: "是否删除",
      field: 'is_deleted'
    },
    createdUser: {
      type: DataTypes.BIGINT,
      allowNull: true,
      comment: "创建人",
      field: 'created_user'
    },
    createdTime: {
      type: DataTypes.DATE,
      allowNull: true,
      comment: "创建时间",
      field: 'created_time'
    },
    updatedUser: {
      type: DataTypes.BIGINT,
      allowNull: true,
      comment: "更新人",
      field: 'updated_user'
    },
    updatedTime: {
      type: DataTypes.DATE,
      allowNull: true,
      comment: "更新时间",
      field: 'updated_time'
    },
    groupId: {
      type: DataTypes.BIGINT,
      allowNull: true,
      defaultValue: 0,
      comment: "分组ID",
      field: 'group_id'
    },
    schemeSystemFile: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "一方案四制度",
      field: 'scheme_system_file'
    },
    investedFunds: {
      type: DataTypes.DECIMAL(16,4),
      allowNull: true,
      defaultValue: 0.0000,
      comment: "安全防护、文明施工措施费用投入资金",
      field: 'invested_funds'
    },
    isNewQuote: {
      type: DataTypes.STRING(2),
      allowNull: true,
      comment: "是否应用先进适用、安全可靠的新工艺、新设备、新材料",
      field: 'is_new_quote'
    },
    isQuoteIntelligence: {
      type: DataTypes.STRING(2),
      allowNull: true,
      comment: "是否应用涉及施工安全的智能建造技术产品",
      field: 'is_quote_intelligence'
    },
    isPilotProject: {
      type: DataTypes.STRING(2),
      allowNull: true,
      comment: "是否是智慧工地试点项目",
      field: 'is_pilot_project'
    },
    emergencyPlan: {
      type: DataTypes.STRING(32),
      allowNull: true,
      comment: "应急预案数量",
      field: 'emergency_plan'
    },
    isGovernmentProject: {
      type: DataTypes.STRING(2),
      allowNull: true,
      comment: "是否是政府投资工程项目",
      field: 'is_government_project'
    },
    isPerformProgram: {
      type: DataTypes.STRING(2),
      allowNull: true,
      comment: "是否履行法定基本建设程序",
      field: 'is_perform_program'
    },
    isPurchaseInsurance: {
      type: DataTypes.STRING(2),
      allowNull: true,
      comment: "是否购买安全生产责任险",
      field: 'is_purchase_insurance'
    },
    premium: {
      type: DataTypes.DECIMAL(16,4),
      allowNull: true,
      defaultValue: 0.0000,
      comment: "承保保费"
    },
    insuranceAmount: {
      type: DataTypes.DECIMAL(16,4),
      allowNull: true,
      defaultValue: 0.0000,
      comment: "保额",
      field: 'insurance_amount'
    },
    isConstructionPermit: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "施工许可证号",
      field: 'is_construction_permit'
    },
    reservePlanBackups: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "监督机构预案备案图片",
      field: 'reserve_plan_backups'
    }
  }, {
    sequelize,
    tableName: 't_project_info',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "project_id" },
        ]
      },
      {
        name: "index_project_id_type",
        using: "BTREE",
        fields: [
          { name: "project_id" },
          { name: "project_type" },
        ]
      },
      {
        name: "index_project_type",
        using: "BTREE",
        fields: [
          { name: "project_type" },
        ]
      },
    ]
  });
};
